package org.spring.aicloud.utils;

import lombok.Data;

import java.io.Serial;
import java.io.Serializable;


/**
 * @author yexiebao
 * @date 2025/5/5
 */
@Data
public class ResponseEntity implements Serializable {
    @Serial
    private static final long serialVersionUID = 45678912345678L;
    private String code;//状态码
    private String message;//状态码描述信息
    private Object data;//返回数据

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
    public static ResponseEntity ok(Object data) {
        ResponseEntity response = new ResponseEntity();
        response.setCode("200");
        response.setMessage("success");
        response.setData(data);
        return response;
    }
    public static ResponseEntity error(String msg) {
        ResponseEntity response = new ResponseEntity();
        response.setCode("500");
        response.setMessage(msg);
        response.setData(null);
        return response;
    }
}